<template>
  <div v-if="!show" class="qr-button" @click="show = true">
    <img class="arrow" src="/images/icon/right-arrow.svg" alt="" />
  </div>
  <div v-else class="qrcode" @click="show = false">
    <div class="title">人才社区地图小程序</div>
    <img class="code" :src="customQrcode" alt="二维码" v-if="customQrcode" />
    <div class="tips">手机微信扫二维码查看</div>
  </div>
</template>
<script setup>
import { getCustomQrcode } from '@/utils/customStorage.js'
import { onMounted, ref } from 'vue'
const customQrcode = ref(null)
const show = ref(true)
// 生命周期
onMounted(() => {
  // 获取自定义二维码
  customQrcode.value = getCustomQrcode()
})
</script>
<style scoped lang="scss">
.qr-button {
  cursor: pointer;
  position: absolute;
  z-index: 1002;
  right: 0px;
  top: 802px;
  transform: translateY(-50%);
  width: 80px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-width: 2px, 0px, 2px, 2px;
  border-style: solid;
  border-color: #ffffff54;
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
  background: linear-gradient(270deg, #44d4a8 0%, #30d1e6 100%);
  box-shadow: 0px 4px 8px 0px #38d3c340;

  .arrow {
    height: 16px;
    width: 16px;
    transform: rotate(180deg);
  }
}
.qrcode {
  z-index: 1000;
  position: absolute;
  width: 192px;
  height: 242px;
  top: 814px;
  left: 1704px;
  border-radius: 16px;
  border: 1px solid #fff;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: #ffffffcc;
  backdrop-filter: blur(8px);
  box-shadow: 0px 8px 16px 0px #0000001a;
  .title {
    font-family: PingFang SC;
    font-weight: 500;
    font-style: Medium;
    font-size: 14px;
    color: #323333;
  }
  .code {
    width: 160px;
    height: 160px;
  }
  .tips {
    font-family: PingFang SC;
    font-weight: 400;
    font-style: Regular;
    font-size: 12px;
    line-height: 18px;
    color: #969799;
  }
}
</style>
